/**
 * @description 用户表
 */
const seq = require('../seq')
const { STRING, DATEONLY, INTEGER } = require('../types')

const User = seq.define('user', {
  account: {
    type: STRING,
    allowNull: false,
    unique: true,
    comment: '用户名，唯一，用于登录',
  },
  password: {
    type: STRING,
    allowNull: false,
  },
  nickName: {
    type: STRING,
    comment: '昵称',
  },
  gender: {
    type: INTEGER,
    comment: '性别，0 女性，1 男性',
  },
  birthday: DATEONLY, // 自设生日，YYYY-MM-DD
  imgUrl: {
    type: STRING,
    comment: '头像图片的服务器地址',
  },
  provinceId: {
    type: INTEGER,
    comment: '所在省份 ID',
  },
  cityId: {
    type: INTEGER,
    comment: '所在城市 ID',
  },
  sign: {
    type: STRING,
    comment: '签名'
  },

  // Sequelize 自动创建的外键：
  // memberId 会员 ID
}, {
  paranoid: true,
})

module.exports = User
